package com.hualu.floatdemofor3d;

import android.content.Context;
import android.os.RemoteException;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;


import com.mstar.android.tvapi.common.TvManager;
import com.mstar.android.tvapi.common.exception.TvCommonException;

import java.util.ArrayList;
import java.util.List;

public class FloatWindowBigView extends LinearLayout {
	/**
	 * 记录大悬浮窗的宽度
	 */
	public static int viewWidth;
	/**
	 * 记录大悬浮窗的高度
	 */
	public static int viewHeight;

	public FloatWindowBigView(final Context context) {
		super(context);
		LayoutInflater.from(context).inflate(R.layout.float_window_big, this);
		View view = findViewById(R.id.big_window_layout);
		viewWidth = view.getLayoutParams().width;
		viewHeight = view.getLayoutParams().height;
		Button Set3DOn = (Button)findViewById(R.id.Set3DOn);
		Button Set3DOff  = (Button)findViewById(R.id.Set3DOff);
		Button Exit = (Button)findViewById(R.id.Exit);
		final EditText text = (EditText)findViewById(R.id.Set3DOnText);
		Set3DOn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				String strtmp = new String("SetProjector/");
				String str = strtmp.concat(text.getText().toString());
				Log.d("hualu", str.trim().toString());
				try {
					Log.d("hualu", "Set3DOn " + TvManager.getInstance().setTvosCommonCommand(str.trim()));
				} catch (TvCommonException e) {
					e.printStackTrace();
				}
			}
		});
		Set3DOff.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
			}
		});
		Exit.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				MyWindowManager.removeBigWindow(context);
				MyWindowManager.createSmallWindow(context);
			}
		});
	}
}
